package com.link.base.base.questionnairesurvey.controller;

import com.link.base.base.questionnairesurvey.model.SurveyUser;
import com.link.base.base.questionnairesurvey.service.SurveyUserService;
import com.link.core.basic.controller.BasicController;
import com.link.core.basic.service.BasicService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

/**
 * @author 刘鲁
 * @date 2018-07-04
 * @comments 作答用户
 */
@Controller
@RequestMapping("/link/surveyUser")
public class SurveyUserController extends BasicController<SurveyUser> {

    @Resource
    private SurveyUserService surveyUserService;

    @Override
    public BasicService<SurveyUser> getBasicService() throws Exception {
        return surveyUserService;
    }

    /**
     * 查询所有有权限作答的用户
     *
     * @param qps
     * @param entity
     * @param session
     * @param request
     * @param response
     * @return createdby: 刘鲁
     */
/*    @RequestMapping(value = "/queryAllUser")
    @ResponseBody
    public Map<String, Object> queryAllUser(@JsonParam QueryParams qps, @JsonParam SurveyUser entity, HttpSession session,
                                            HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> result = new HashMap<String, Object>();
        try {
            qps.preDealSecurity(request);
            SurveyUser t = (SurveyUser) BasicModel.transformClass(entity, qps);
            List<SurveyUser> list = surveyUserService.queryAllUserExamplePage(t);
            result.put("success", true);
            result.put("rows", list);
            result.put("total", getCount((BasicModel) t, list.size()));
        } catch (BasicServiceException e) {
            LCLogger.withException(e);
            result.put("success", false);
            result.put("rows", new ArrayList<SurveyUser>());
            result.put("result", e.getMessage());
            result.put("detailMessage", e.getDetailMessage());
        } catch (Exception e) {
            LCLogger.withException(e);
            result.put("success", false);
            result.put("rows", new ArrayList<SurveyUser>());
            result.put("result", e.getMessage());
        }
        return result;
    }*/

}
